//
//  UWGamesManager.h
//  Urban Words
//
//  Created by Tim Brandin on 2011-11-25.
//  Copyright (c) 2011 Sypreme. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "UWGame.h"
#import "UWFriend.h"
#import "Facebook.h"
#import "UWGamesDelegate.h"
#import "sqlite3.h"

@interface UWGamesManager : NSObject <NSURLConnectionDataDelegate, NSURLConnectionDataDelegate> {
    sqlite3 *gamesDB;
    
    NSString *dbPath;
    
    id <UWGamesDelegate> delegate;
    
    NSDate *lastUpdated;
}

@property (retain) id delegate;

@property (readonly) NSInteger ongoing;
@property (readonly) NSInteger count;
@property (retain, nonatomic) Facebook *facebook;

- (void)gamesLoaded:(NSData *)data;
- (void)refresh;
- (void)updateGames;
+ (UWGamesManager *)sharedManager;
- (UWGame *)getGame:(int)gameid;
- (UWGame *)getGameAt:(NSInteger)row;
- (NSArray *)getAllGameFriends;
- (void)clear;

@end
